package testsite4;

public class Player {
    
    private String name;
    private int health;
    private int maxHealth;
    private int damage;
    private int defence;
    private int level;
    private int EXP;
    private int gold;
    
    public Player() {
        
    }
    
    public Player(String n, int h, int d, int def) {
        
        name = n;
        health = h;
        maxHealth = h;
        damage = d;
        defence = def;
        level = 1;
        EXP = 0;
        gold = 0;
        
    }
    
    public void gainGold(int g) {
        
        gold += g;
        
    }
    
    public void loseGold(int g) {
        
        gold -= g;
        
    }
    
    public int Gold() {
        
        return gold;
        
    }
    
    public int Attack() {
        
        return damage;
        
    }
    
    public void Defend(int d) {
        
        health -= d;
        
    }
    
    public void Heal() {
     
        health = maxHealth;
        
    }
    
    public void lvlUp(int e) {
        
        EXP += e;
        if (EXP >= (level * 10)) {
            EXP -= (level * 10);
            level++;
        }
        
    }
    
    public String toString() {
        
        return name + "\nHp: " + health + "\nDmg: " + damage + "\nLvl: " 
                + level + "\nEXP: " + EXP + "\nGold: " + gold;
        
    }
    
}
